<!-- <link rel="stylesheet" href="../../../../../../../工作项目/模板/css/common.css"> -->

{include file="public/header"}

<style type="text/css">
.index_section3 .center ul li .boss .a2 .p2 .s2{color:#000;}
.index_section3 .center ul li .boss .a2 .p2 .s1{color:#000;}
.res_section1 .all_1 .f1 .s1{color:#fff;}
.res_section1 .all_1 .f2 .s1{color:#fff;}
.f1 .input1, .f2 .input1::-webkit-input-placeholder {
	color: #fff;
}
.f1 .input1, .f2 .input1:-moz-placeholder {
	color: #fff;
}
.f1 .input1::-webkit-input-placeholder {
	color: #fff;
}
.f1 .input1:-moz-placeholder {
	color: #fff;
}
.f1 .input1,.f2 .input1{color:#fff;background:none;border:#000 1px solid;}
::-webkit-input-placeholder {color: #000;}
::-moz-placeholder {color: #000;}
:-ms-input-placeholder {color: #000;}
.in_body{background:#E6FDCD;color:#000;}
.bg_fixed{position: fixed;
	width: 100%;
	top: 0px;
	left: 0px;
	z-index: -1;
	background: url(__PUBLIC__/home/images/v10_a9.png);
	background-size: 100% 100%;}
</style>
<body class="">
	<div class="sectionY sectionY_tttt">
		<a href="javascript:history.back();">
			<img src="__PUBLIC__/home/images/v10_a9.png" alt="" class="a1">
		</a>
		<p class="p1" style="color: #fff">
			<span class="ppp_title">注册</span>
		</p>
	</div>
	<div class="kong1"></div>
	<div class="bg_fixed_v10_1"></div>
	<div class="res_section1">
		<form action="" enctype="multipart/form-data">
			<div class="all_1">
				<div class="f2 clearfix">
					<span class="s1 ">手机号码</span>
					<input type="text" name="selfphone" class="input1" placeholder="请输入手机号" autocomplete="off">
					<span class="s2" id="getVcode">获取验证码</span>
				</div>

				<!-- <div class="f2">
					<span class="s1 ">验证码：</span>
					<input type="text" name="vcode" class="input1" placeholder="图形验证码" autocomplete="off">
					<span class="s2" id="getVcode">
							<img class='s2' src="{:captcha_src()}" alt="captcha" onclick="this.src='{:captcha_src()}'" />
					</span>
				</div> -->




				<div class="f1 clearfix">
					<span class="s1 ">验证码</span>
					<input type="text" name="vcode" class="input1" placeholder="请输入短信验证码" autocomplete="off">
				</div>
				<div class="f1 clearfix">
					<span class="s1 ">用户名</span>
					<input type="text" name="username" class="input1" placeholder="请输入用户名" maxlength="11"  autocomplete="off">
				</div>
				<div class="f1 clearfix">
					<span class="s1 ">登录密码</span>
					<input type="password" name="passwd" class="input1" placeholder="请输入登录密码" autocomplete="off">
				</div>
				<div class="f1 clearfix">
					<span class="s1 ">确定登录密码</span>
					<input type="password" name="confirm_passwd" class="input1" placeholder="请再次输入登录密码" autocomplete="off">
				</div>
				<div class="f1 clearfix">
					<span class="s1 ">二次密码</span>
					<input type="password" name="sepasswd" class="input1" placeholder="请输入交易密码" autocomplete="off">
				</div>
				<div class="f1 clearfix">
					<span class="s1 ">确定二次密码</span>
					<input type="password" name="confirm_sepasswd" class="input1" placeholder="请再次输入交易密码" autocomplete="off">
				</div>
				<div class="f1 clearfix">
					<span class="s1 ">邀请码</span>
					<input type="text" name="invite_code" class="input1" placeholder="请填写推荐人" value="{$code}">
				</div>
				<div class="f3 clearfix">
					<span class="s1">注册即视为同意</span><a href="{:url('Index/treaty')}">《用户协议及隐私政策》</a>
				</div>
				<div class="sub">
					<input type="button" id="submit" value="提交注册">
				</div>
			</div>
		</form>
	</div>
</body>
<script>
    var is_enable=true;
	$(function(){
		$("#getVcode").click(function () {
		    var telephone = $("input[name='selfphone']").val();
		    if(!is_enable){
                return false;
            }
		    if(telephone.trim() == ""){
                layer.msg("手机号不能为空");
                return false;
            }
            var times = 60;
            $.post('{:url("Index/getVcode")}', {telephone:telephone, type:1}, function (res) {
                if(res.result_code == 0){
                    is_enable = false;
                    $("#getVcode").html(times+"秒后发送");
                    var index = setInterval(function () {
                        if(times == 0){
                            clearInterval(index);
                            is_enable = true;
                            $("#getVcode").html("发送验证码");
                        }else{
                            times--;
                            $("#getVcode").html(times+"秒后发送");
                        }
                    }, 1000);
                }else{
                    layer.msg(res.result_info);
                }
            });
		});
		$("#submit").click(function () {
			var data = {};
			data.selfphone = $.trim($("input[name='selfphone']").val());
			data.vcode = $.trim($("input[name='vcode']").val());
			data.username = $.trim($("input[name='username']").val());
			data.passwd = $.trim($("input[name='passwd']").val());
			data.confirm_passwd = $.trim($("input[name='confirm_passwd']").val());
			data.sepasswd = $.trim($("input[name='sepasswd']").val());
			data.invite_code = $.trim($("input[name='invite_code']").val());
			data.confirm_sepasswd = $.trim($("input[name='confirm_sepasswd']").val());
			var re = /^[0-9]+.?[0-9]*$/;
		    
		    //验证用户名不能全部为数字
		    
		    

			if(data.selfphone == ""){
				layer.msg("手机号不能为空");
				return false;
			}
			if(data.vcode == ""){
				layer.msg("验证码不能为空");
				return false;
			}
			
			if(data.username == "" || data.username==undefined){
				layer.msg("用户名不能为空");
				return false;
			}
		    if (re.test(data.username)) {
		        layer.msg("用户名不能为数字开头");
				return false;
		    }


			if(data.passwd == ""){
				layer.msg("密码不能为空");
				return false;
			}
			if(data.sepasswd == ""){
				layer.msg("二级密码不能为空");
				return false;
			}
			if(data.invite_code == ""){
				layer.msg("请填写推荐人");
				return false;
			}
			$.post("{:url('Index/register')}", data, function (res) {
				if(res.result_code == 0){

					layer.confirm('注册成功，现在跳转到下载？？',{btn: ['跳转', '不跳转'],shade:0.8,title:"您已注册成功"}, function(){
						var downurl = '{:config("setting.downloadurl")}';
						window.location.href = downurl;
					},function(){
						var downurl = '{:url("Index/login")}';
						window.location.href = downurl;
					});
					return false;
					// setTimeout(function () {
					// 	location.href="{:url('Index/index')}";
					// })
				}else{
					layer.msg(res.result_info);
				}
			});

        });
	})
</script>
</html>
